# -*- coding: utf-8 -*-
"""
file:ch6_4常数的定积分
author: Fuwen
time: 2022/7/17 20:50
software:PyCharm
"""
import numpy as np
import matplotlib.pyplot as plt

# 被积函数为常数-4, ∫(4)dx, F(x) = 4*x
# 积分区间[0,3]

# 被积函数的系数
c = -4

# 绘制定积分图形
x = np.linspace(0, 4, 1000)
y = [c for x in x]

plt.plot(x, y )
plt.fill_between(x, y1=y, y2=0, where=(x>=0)&(x<=3), facecolor='lightblue')

plt.grid()
plt.show()